$:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
require 'test/unit'
require "snippet"

module LWA
  class ConditionalTest < Test::Unit::TestCase

    def test_conditional_step
      cs = LWA::TestCaseDoc.new("sample_testcase.xml").get_case(10).step_list.first
      assert_equal "condition_assert", cs.condition_step.command
      assert_equal 4, cs.content_steps.length
    end

    def test_conditional_step_with_snippet
      cs = LWA::TestCaseDoc.new("sample_testcase.xml").get_case(11).step_list.first
      assert_equal 2, cs.content_steps.length
      assert_equal 3, cs.content_steps[1].steps.length
    end

    def test_conditional_step_with_conditional
      cs = LWA::TestCaseDoc.new("sample_testcase.xml").get_case(12).step_list.first
      assert_equal 2, cs.content_steps.length
      assert_equal "open_url2", cs.content_steps[1].content_steps[0].command
    end
  end
end